<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>File: utf8_example_controller.rb</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



  <div id="fileHeader">
    <h1>utf8_example_controller.rb</h1>
    <table class="header-table">
    <tr class="top-aligned-row">
      <td><strong>Path:</strong></td>
      <td>app/controllers/fusioncharts/utf8_example_controller.rb
      </td>
    </tr>
    <tr class="top-aligned-row">
      <td><strong>Last Update:</strong></td>
      <td>Tue Dec 02 13:31:48 +0530 2008</td>
    </tr>
    </table>
  </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <pre>
 Contains actions to show the UTF-8 chart examples.
</pre>
<p>
To use FusionCharts with UTF-8 characters, remember the following:
</p>
<ul>
<li>dataURL method has to be used to get the xml.

</li>
<li>Rotated text cannot render UTF-8 characters. For example, UTF-8 characters
in the rotated labels will not be rendered correctly.

</li>
<li>BOM has to present in the xml given as input to the chart.

</li>
</ul>
<p>
Steps to ensure correct UTF-8 output:
</p>
<ul>
<li>&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html;
charset=utf-8&quot; /&gt; has to be present in the &lt;head&gt; section of
the page which contains UTF8 characters. Notice that we have included this
in the &quot;common.html.erb&quot; layout, so that it is avialable to all
pages.

</li>
<li>Put this, headers[&quot;Content-Type&quot;] = &quot;text/xml;
charset=utf-8&quot; in the action which is the XML provider. ( Here,
pie_data_french or pie_data_japanese actions)

</li>
<li>If you are using a xml file for the data, then the file should be saved
with UTF-8 encoding with UTF-8 BOM. It should have the xml declaration
also: &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;

</li>
<li>If you are generating xml dynamically, then in the xml provider ( here,
pie_data_japanese.html.erb and pie_data_french.html.erb ), use get_UTF8_BOM
and assign the BOM to the xml as initial value. This function present in
fusioncharts_helper library.

</li>
<li>After placing the BOM in the xml string, append the xml declaration:
&lt;?xml version=&#8216;1.0&#8217; encoding=&#8216;UTF-8&#8217;?&gt;.
Finally, append the actual chart xml.

</li>
<li>For using data from database, the default character set of the database
should be UTF-8. This can be done using the sql command:

</li>
</ul>
<p>
ALTER DATABASE DEFAULT CHARACTER SET = utf8;
</p>
<pre>
 The default charset of the table containing the UTF characters should be UTF-8. This can be done by adding &quot;DEFAULT CHARSET=utf8;&quot; at the end of the table definition.
 In the config/database.yml file the setting for encoding should be: encoding: UTF8
 For more details on UTF specific code, please see the view where the code resides.
</pre>

    </div>


   </div>


  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>